<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title></title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="robots" content="all,follow">
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="robots" content="all,follow">
  <!-- Bootstrap CSS-->
  <link rel="stylesheet" href="./content/css/bootstrap.min.css">
  <!-- Font Awesome CSS-->
  <link rel="stylesheet" href="./content/css/font-awesome.min.css">
  <!-- Fontastic Custom icon font-->
  <link rel="stylesheet" href="./content/css/fontastic.css">
  <!-- Google fonts - Poppins -->
  <!-- theme stylesheet-->
  <link rel="stylesheet" href="./content/css/style.default.css" id="theme-stylesheet">
  <!-- Custom stylesheet - for your changes-->
  <link rel="stylesheet" href="./content/css/custom.css">
  <!-- Favicon-->
  <link rel="shortcut icon" href="./content/img/favicon.ico">
  <!-- Tweaks for older IEs-->
  <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
</head>

<body>
  <div class="page login-page app">
    <div class="container d-flex align-items-center">
      <div class="form-holder has-shadow">
        <div class="row">
          <!-- Logo & Information Panel-->
          <div class="col-lg-6">
            <div class="info d-flex align-items-center">
              <div class="content">
                <div class="logo">
                  <h1>砍价小程序</h1>
                </div>
                <p></p>
              </div>
            </div>
          </div>
          <!-- Form Panel    -->
          <div class="col-lg-6 bg-white">
            <div class="form d-flex align-items-center">
              <div class="content">
                <form method="post" class="form-validate">
                  <div class="form-group">
                    <input id="login-username" type="text" name="loginUsername" required
                      data-msg="Please enter your username" class="input-material" v-model="info.username"
                      placeholder="用户名">
                    <label for="login-username" class="label-material"></label>
                  </div>
                  <div class="form-group">
                    <input id="login-password" type="password" name="loginPassword" required
                      data-msg="Please enter your password" class="input-material" v-model="info.password"
                      placeholder="密码">
                    <label for="login-password" class="label-material"></label>
                  </div><a id="login" href="#" class="btn btn-primary" @click="login">登 录</a>
                  <!-- This should be submit button but I replaced it with <a> for demo purposes-->
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="copyrights text-center">
      <p style="color: #000;">
        <!-- Please do not remove the backlink to us unless you support further theme's development at https://bootstrapious.com/donate. It is part of the license conditions. Thank you for understanding :)-->
      </p>
    </div>
  </div>
  <!-- JavaScript files-->

</body>

<link href="./content/plugin/sweetalert/sweetalert.css" rel="stylesheet">
<script src="./content/plugin/sweetalert/sweetalert.min.js"></script>
<script src="./content/js/jquery-1.10.2.min.js"></script>
<script src="./content/js/vue2.js"></script>

<script>


  var vm = new Vue({
    el: ".app",
    data: {

      info: {
        username: "",
        password: ""
      }
    },
    methods: {
      login: function (addobj) {
        var self = this;
        $.post("/login", this.info, function (data) {
          console.log("data", data)

          if (data.status == "200") {

            localStorage.setItem("mid", data.data.mid);

            localStorage.setItem("userinfo", JSON.stringify(data.data));
            localStorage.setItem("truename", data.data.truename)

            localStorage.setItem("userid", data.data.id)


            setTimeout(() => {
              window.location.href = "./index.html";
            }, 200);

          } else {
            swal("系统提示", data.message, "info");

          }
        });
      },

    },

    created: function () {  //初始化事件里边去调用查询方法



    }
  });


</script>

</html>